﻿/*
** Xin YUAN, 2021, BSD (2)
*/

/*
Author: Shijie Zhang, 2019
*/

//------------------------------------------------------------------------------
// classes

// Md5_Value

struct Md5_Value
{
	uint32_t a, b, c, d;  //128 bits
};

// Md5Calc

class Md5Calc
{
public:
	Md5Calc() noexcept;
	Md5Calc(const Md5Calc&) = delete;
	Md5Calc& operator=(const Md5Calc&) = delete;
	~Md5Calc() noexcept;

	void Initialize() noexcept;
	bool Input(const uint8_t* pBuffer, uint64_t uSize) noexcept;
	bool End() noexcept;

	const Md5_Value& GetValue() const noexcept;

private:
	Md5_Value   m_value;
	uint8_t     m_buffer[64];    //512 bits
	uint32_t    m_size;          //actual size
	uint64_t    m_uTotalSize;    //total size
};

//------------------------------------------------------------------------------
// inline

#include "md5.inl"

////////////////////////////////////////////////////////////////////////////////
